<template>
	<view>
		<view :style="{ paddingBottom: 120 + 'rpx' }" class="safearea"></view>
		<custom-tab-bar :items="todos?tabItems:tabItems1" :currentIndex="currentIndex" @item-click="onTabClick"
			:color="color" :selectedColor="selectedColor"></custom-tab-bar>
	</view>
</template>

<script>
	import CustomTabBar from '@/uni_modules/niceui-tabBar/components/niceui-tabBar/niceui-tabBar.vue';
	import $store from '@/store/index.js';
	export default {
		components: {
			CustomTabBar
		},
		props: {
			currentIndex: {
				type: Number,
				default: 0
			},
		},
		data() {
			return {
				tabItems: [{
						pagePath: "/pages/index/index",
						icon: "/static/images/nav1.png",
						selectedIcon: "/static/images/nav1-active.png",
						text: "首页",
						isHow: true,
					}, {
						pagePath: "/pages/classify/classify",
						icon: "/static/images/nav2.png",
						selectedIcon: "/static/images/nav2-active.png",
						text: "分类",
						isHow: true,
					},
					{
						pagePath: "/pages/news/news-list",
						icon: "/static/images/nav5.png",
						selectedIcon: "/static/images/nav5-active.png",
						text: "文章",
						isHow: true,
					},
					{
						pagePath: "/pages/square/square",
						icon: "/static/images/nav3.png",
						selectedIcon: "/static/images/nav3-active.png",
						text: "广场",
						isHow: true,
					}, {
						pagePath: "/pages/my/my",
						icon: "/static/images/nav4.png",
						selectedIcon: "/static/images/nav4-active.png",
						text: "我的",
						isHow: true,
					}
				],
				color: '#666',
				selectedColor: '#17bf8b',
				safeareaHeight: 0,

			}
		},
		onLoad() {},
		onShow() {},
		computed: {
			todos() {
				return true
			}
		},
		methods: {
			onTabClick(index) { // 切换tab的函数，当选中某个tab时触发
				if (index != this.currentIndex) {
					let item = this.tabItems[index]
					uni.switchTab({
						url: item.pagePath
					})
				}
			}
		}
	}
</script>

<style>

</style>